/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020.
 * Description: add support for ipi combine
 * Author: fuxiancheng <fuxiancheng@huawei.com>
 * Create: 2020-12-23
 */

#ifndef LINUX_RTOS_HAL_IPICOMBINE_H
#define LINUX_RTOS_HAL_IPICOMBINE_H

#ifdef CONFIG_RTOS_HAL_IPI_COMBINE
typedef struct {
	/* prepare 3 ipi_irq counters for 6~8 combined ipi */
	unsigned int ipi_irqs[3];
	unsigned long bits;
	spinlock_t lock;
} ____cacheline_aligned ipi_cpustat_t;

#define ipi_stat(cpu, member)   (per_cpu(combined_ipi_stat.member, cpu))

#define __get_irq_stat(cpu, member) (ipi_stat(cpu, member))
#define __set_irq_stat(cpu, member, value) (ipi_stat(cpu, member) = value)
#define __inc_irq_stat(cpu, member) (ipi_stat(cpu, member)++)
#endif

#endif /* LINUX_RTOS_HAL_IPICOMBINE_H */
